package com.etao.restaurantdao.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.etao.restaurantdao.base.BaseDao;
import com.etao.restaurantdao.dao.inter.ISupplierDishDao;
import com.etao.restaurantentity.common.page.PagerModel;
import com.etao.restaurantentity.req.SupplierLogin;
import com.etao.restaurantentity.resp.SupplierQuery;
import com.etao.restaurantentity.servicedomain.SupplierDish;
import com.etao.restaurantentity.servicedomain.SupplierServiceInfo;

@Repository
public class SupplierDishDaoImpl implements ISupplierDishDao {
	@Autowired
	private BaseDao dao;

	public PagerModel selectPageList(SupplierDish e) {
		return dao.selectPageList("front.account.selectPageList", "front.account.selectPageCount", e);
	}

	public SupplierDish selectById(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	public List selectList(SupplierDish e) {
		return dao.selectList("front.account.selectList", e);
	}

	public SupplierDish selectOne(SupplierDish e) {
		return (SupplierDish) dao.selectOne("front.account.selectOne", e);
	}

	public int delete(SupplierDish e) {
		return dao.delete("front.account.delete", e);
	}

	public int update(SupplierDish e) {
		return dao.update("front.account.update", e);
	}

	public int deletes(int[] ids) {
		SupplierDish e = new SupplierDish();
		for (int i = 0; i < ids.length; i++) {
			e.setId(ids[i]);
			delete(e);
		}
		return 0;
	}

	public int insert(SupplierDish e) {
		return dao.insert("front.account.insert", e);
	}

	public int deleteById(int id) {
		return dao.delete("front.account.deleteById", id);
	}

	public int selectCount(SupplierDish e) {
		return dao.getCount("front.account.selectCount", e);
	}

	@Override
	public List<SupplierDish> selectSupplierDishMenu(SupplierDish e) {
		return dao.selectList("SupplierDish.selectSupplierDishMenuForApp", e);
	}

	@Override
	public int insertList(List<SupplierDish> list) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<SupplierQuery> GetSupplierQuery(Map<String, String> map) {
		SupplierLogin login = new SupplierLogin();
		login.setUserName(map.get("userName"));
		login.setPwd(map.get("pwd"));
		return dao.selectList("SupplierDish.GetSupplierQuery", login);
	}

	@Override
	public Integer GetFeatureCount(Integer supplierId) {
		return (Integer) dao.selectOne("SupplierDish.GetFeatureCount", supplierId);
	}

	@Override
	public SupplierServiceInfo FindBySupplierId(Map<String, Integer> map) {
		Object obj=dao.selectOne("SupplierServiceInfoFindBySupplierId", map);
		return (SupplierServiceInfo)obj;
	}

	@Override
	public int Insert(SupplierServiceInfo info) {
		return dao.insert("SupplierServiceInfoInsert", info);

	}
}
